﻿using System;
using System.Drawing;

namespace org.xisoft.game.utils.game
{
    /**
     * 棋是放在线上
     */ 
    public abstract class NormalBroadControl : ChessBoardPanelBase
    {

        public NormalBroadControl(int maxX,int maxY)
            :base(maxX, maxY)
        {

        }

        protected override void DrawChessBoardRow(Graphics g, int index, int left, int top, int width)
        {
            base.DrawChessBoardRow(g, index, left, top, width);
            String leftText = (index + 1) + "";

            g.DrawString((index + 1) + "", Font, broadFontBrush, 2, top - 8);
        }

        protected override void DrawChessBoardCol(Graphics g, int index, int left, int top, int height)
        {
            base.DrawChessBoardCol(g, index, left, top, height);

            char topText = (char)('A' + index);
            g.DrawString(topText.ToString(), Font, broadFontBrush, left - 6, 2);
        }


        public override void OnMouseClick(int mouseX, int mouseY)
        {
            int x = (mouseX - Rect.Left + GridItemWidth / 2) / GridItemWidth;
            int y = (mouseY - Rect.Top + GridItemHeight / 2) / GridItemHeight;
            OnClick(x, y);
        }

        protected abstract void OnClick(int x, int y);



    }
}
